package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.Grade;
import com.zyg.pojo.Grade;
import com.zyg.pojo.Major;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface GradeMapper extends BaseMapper<Grade> {
    @Select(" select  *  from grade")
    List<Grade> getGradeList();

    @Override
    @Select("select grade_id,grade_name,major_id from grade ${ew.customSqlSegment}")
    @Results({
            @Result(property = "gradeId", column = "grade_id"),
            @Result(property = "gradeName", column = "grade_name"),
            @Result(property = "major", column = "major_id", javaType = Grade.class,
                    one = @One(select = "com.zyg.dao.MajorMapper.getMajorById"))
    })
    List<Grade> selectList(IPage<Grade> page, @Param(Constants.WRAPPER) Wrapper<Grade> queryWrapper);
    
}
